// Copyright 2023 The titan-search Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#include <iostream>
#include <tally/tally.h>

int main() {
    tally::JsonDumper::instance()->start().ignore_error();
    tally::Counter<int64_t> g_counter("m_counter", "my counter test");
    auto buckets = tally::Buckets::linear_values(0.0, 1.0, 10);
    tally::Histogram g_his(buckets, "m_his", "my hist test");
    tally::init_sigar_metric();
    int i= 0;
    while (i < 1000) {
        g_counter<<1;
        g_his.record(random()%10);
        i++;
        usleep(100000);
    }
    tally::JsonDumper::instance()->stop();
}
